import QtQuick 2.2
import "../images"

Rectangle {
    id: item
    property string picpath: ""
    property string content: ""
    property string backcolor: "#808080"
    property string fontcolor: ""
    property string clickcolor: ""
    property string bordercolor: ""
    property int borderwidth: 0
    property int fontsize: 14
    property int index: -1
    property bool isclick: false
    signal onclick(bool isclicked,int index, string title)

    function release()
    {
        content = ""
        picpath = ""
        isclick = false
        visible = false
    }

    width: 80; height: 50
    border.color: bordercolor
    border.width: borderwidth
    visible: false
    color: backcolor
    radius: 5
    Row{
        Image{
            width: parent.width/4
            id: pic
            source: picpath
        }

        Text {
            width: parent.width*3/4; height: parent.height
            id: text
            text: content
            font.pixelSize:fontsize
            elide: Text.ElideRight
            wrapMode: Text.WordWrap
            verticalAlignment: Text.AlignVCenter
            anchors.top: parent.top
        }
        anchors.fill: parent
    }
//    MouseArea{
//        anchors.fill: parent
//        onClicked:{
//            if(!isclick)
//            {
//                item.color = clickcolor
//                isclick = true
//            }
////            else
////            {
////                item.color = backcolor
////                isclick = false
////            }

//            if(index !== -1)
//            {
//                onclick(isclick, index, content)
//            }
//        }
//    }// MouseArea

}
